/**
 * New DeviceOne File
 */
var d1 = require('deviceone')
var Paging = d1.Class({}, function(config) {
	var defualt = {
		size:8,
		page:0
	}
	config = config || {}
	this.size = config.size||defualt.size
	this.page = config.page||defualt.page
	this.totle = 0
	this.config = {
		page:this.page,
		size:this.size
	}
})


// 扩展基础方法
d1.merge(Paging.fz, {
	/**
	 * 进行页面数据刷新
	 */
	next : function() {
		if(this.page < this.totle){
			this.page += 1	
			return true
		}else{
			return false
		}
	},
	reset:function(){
		this.size = this.config.size
		this.page = this.config.page
	},
	/**
	 * 更新header信息
	 */
	getConfig : function() {
		return {
			page:this.page,
			size:this.size
		}
	}
})

module.exports.create = function(){
	return new Paging()
}